package com.transaction.demo.test;

public class FindMost {

    //TODO温故3
    public static void main(String[] args) {
        //查出数据最多的数字
        int[] arr = {1, 2, 3, 5, 4, 6, 5, 5, 6, 5, 6, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 6, 6, 6};

        int count3 = 0;
        int value = 0;
        for (int i = 0; i < arr.length; i++) {
            int number = 0;
            for (int j = i; j < arr.length; j++) {
                if (arr[i] == arr[j]) {
                    number += 1;
                }
            }
            if (count3 <= number) {
                count3 = number;
                value = arr[i];

            }
        }
        System.out.println("count：" + count3 + "value：" + value);


        int count = 0;
        int number = 0;
        for (int i = 0; i < arr.length; i++) {
            int count2 = 0;
            for (int j = 0; j < arr.length; j++) {
                if (arr[i] == arr[j]) {
                    count2 = count2 + 1;
                }
            }
            if (count2 < count) {
                continue;
            } else {
                count = count2;
                number = arr[i];
            }
        }
        System.out.println("))))" + count + "(((" + number);

    }

}
